package com.uam.db.model.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;

/**
 * 系统访问记录表 sys_logininfor
 *
 * @author uam
 */
@ApiModel(value = "用户登录日志")
public class SysLogininfor extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    @ApiModelProperty("登录日志ID")
    private Long infoId;

    /** 操作动作 */
    @ApiModelProperty(value = "操作动作")
    private String title;

    /** 登录名 */
    @ApiModelProperty(value = "登录名")
    private String loginName;

    /** 用户名称 */
    @ApiModelProperty(value = "用户姓名")
    private String userName;

    /** 操作结果 0成功 1失败 */
    @ApiModelProperty(value = "操作结果 0=成功,1=失败")
    private String status;

    /** 登录IP地址 */
    @ApiModelProperty(value = "登录IP地址")
    private String ipaddr;

    /** 登录地点 */
    @ApiModelProperty(value = "登录地点", hidden = true)
    private String loginLocation;

    /** 浏览器类型 */
    @ApiModelProperty(value = "浏览器", hidden = true)
    private String browser;

    /** 操作系统 */
    @ApiModelProperty(value = "操作系统", hidden = true)
    private String os;

    /** 登录信息 */
    @ApiModelProperty(value = "登录信息")
    private String msg;

    /** 登录时间 */
    @ApiModelProperty(value = "登录时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date loginTime;

    @ApiModelProperty(value = "登录时间时间戳，前端展示使用该字段")
    private Long loginDateTime;

    public Long getLoginDateTime() {
        return loginTime != null ? loginTime.getTime() / 1000 : null;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Long getInfoId()
    {
        return infoId;
    }

    public void setInfoId(Long infoId)
    {
        this.infoId = infoId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLoginName()
    {
        return loginName;
    }

    public void setLoginName(String loginName)
    {
        this.loginName = loginName;
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getIpaddr()
    {
        return ipaddr;
    }

    public void setIpaddr(String ipaddr)
    {
        this.ipaddr = ipaddr;
    }

    public String getLoginLocation()
    {
        return loginLocation;
    }

    public void setLoginLocation(String loginLocation)
    {
        this.loginLocation = loginLocation;
    }

    public String getBrowser()
    {
        return browser;
    }

    public void setBrowser(String browser)
    {
        this.browser = browser;
    }

    public String getOs()
    {
        return os;
    }

    public void setOs(String os)
    {
        this.os = os;
    }

    public String getMsg()
    {
        return msg;
    }

    public void setMsg(String msg)
    {
        this.msg = msg;
    }

    public Date getLoginTime()
    {
        return loginTime;
    }

    public void setLoginTime(Date loginTime)
    {
        this.loginTime = loginTime;
    }
}
